package com.ghost.manager
{
	import com.ghost.interfaces.Ibaseui;
	import com.ghost.view.UI.UI_main;
	
	import flash.display.DisplayObject;
	import flash.display.Sprite;

	/**
	 *ui界面管理 
	 * @author ghost
	 */	
	public class UI_manager
	{
		private static var instance:UI_manager;
		public static function getInstance():UI_manager
		{
			if(instance==null)
			{
				instance = new UI_manager();
			}
			return instance;
		}
		/**
		 *ui容器 
		 */		
		public var ui_container:UI_main;
		public function UI_manager()
		{
			
		}
		/**
		 * 增加新的ui
		 */		
		public function creat_ui(mc:DisplayObject):void
		{
			if(ui_container)ui_container.addChild(mc);
			Ibaseui(mc).reflash_x_y(null);
		}
		/**
		 * 更新所有ui坐标
		 */		
		public function update():void
		{
			var num:int = ui_container.numChildren;
			var i:int = 0;
			for(;i<num;i++)
			{
				trace(ui_container.getChildAt(i));
				Ibaseui(ui_container.getChildAt(i)).reflash_x_y(null);
			}
		}
	}
}